<?php

namespace App\Models\Sku;

use Illuminate\Database\Eloquent\Model;

class Attr extends Model
{
	protected $table = 'sku_attrs';

	protected $guarded = array();

	protected $with = ['specs'];

	public function product()
	{
		return $this->belongsTo('\App\Models\Sku\Product');
	}


	public function specs()
	{
		return $this->hasMany('\App\Models\Sku\Spec');
	}


	public function scopePid($query, $pid)
    {
    	return $query->where('product_id', $pid);
    }

}